.class public Lcom/netease/newsreader/view/MyGallery;
.super Landroid/widget/Gallery;
.source "MyGallery.java"


# instance fields
.field private mAutoRunnable:Ljava/lang/Runnable;

.field private mAutoTimeInterval:I

.field private mXXXRunnable:Ljava/lang/Runnable;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 36
    invoke-direct {p0, p1}, Landroid/widget/Gallery;-><init>(Landroid/content/Context;)V

    .line 25
    new-instance v0, Lcom/netease/newsreader/view/MyGallery$1;

    invoke-direct {v0, p0}, Lcom/netease/newsreader/view/MyGallery$1;-><init>(Lcom/netease/newsreader/view/MyGallery;)V

    iput-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoRunnable:Ljava/lang/Runnable;

    .line 37
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->init()V

    .line 38
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 50
    invoke-direct {p0, p1, p2}, Landroid/widget/Gallery;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 25
    new-instance v0, Lcom/netease/newsreader/view/MyGallery$1;

    invoke-direct {v0, p0}, Lcom/netease/newsreader/view/MyGallery$1;-><init>(Lcom/netease/newsreader/view/MyGallery;)V

    iput-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoRunnable:Ljava/lang/Runnable;

    .line 51
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->init()V

    .line 52
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 1
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 43
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/Gallery;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 25
    new-instance v0, Lcom/netease/newsreader/view/MyGallery$1;

    invoke-direct {v0, p0}, Lcom/netease/newsreader/view/MyGallery$1;-><init>(Lcom/netease/newsreader/view/MyGallery;)V

    iput-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoRunnable:Ljava/lang/Runnable;

    .line 44
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->init()V

    .line 45
    return-void
.end method

.method static synthetic access$0(Lcom/netease/newsreader/view/MyGallery;)V
    .locals 0
    .parameter

    .prologue
    .line 135
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->scrollRight()V

    return-void
.end method

.method static synthetic access$1(Lcom/netease/newsreader/view/MyGallery;)I
    .locals 1
    .parameter

    .prologue
    .line 18
    iget v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoTimeInterval:I

    return v0
.end method

.method private getCenterOfGallery()I
    .locals 2

    .prologue
    .line 99
    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getWidth()I

    move-result v0

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getPaddingLeft()I

    move-result v1

    sub-int/2addr v0, v1

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getPaddingRight()I

    move-result v1

    sub-int/2addr v0, v1

    div-int/lit8 v0, v0, 0x2

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getPaddingLeft()I

    move-result v1

    add-int/2addr v0, v1

    return v0
.end method

.method private static getCenterOfView(Landroid/view/View;)I
    .locals 2
    .parameter "view"

    .prologue
    .line 106
    invoke-virtual {p0}, Landroid/view/View;->getLeft()I

    move-result v0

    invoke-virtual {p0}, Landroid/view/View;->getWidth()I

    move-result v1

    div-int/lit8 v1, v1, 0x2

    add-int/2addr v0, v1

    return v0
.end method

.method private init()V
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 55
    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/MyGallery;->setSpacing(I)V

    .line 56
    const/high16 v0, 0x3f80

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->setUnselectedAlpha(F)V

    .line 57
    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/MyGallery;->setSoundEffectsEnabled(Z)V

    .line 58
    invoke-virtual {p0, v1}, Lcom/netease/newsreader/view/MyGallery;->setFadingEdgeLength(I)V

    .line 59
    return-void
.end method

.method private scrollLeft()V
    .locals 2

    .prologue
    .line 132
    const/16 v0, 0x15

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Lcom/netease/newsreader/view/MyGallery;->onKeyDown(ILandroid/view/KeyEvent;)Z

    .line 133
    return-void
.end method

.method private scrollRight()V
    .locals 2

    .prologue
    .line 136
    const/16 v0, 0x16

    const/4 v1, 0x0

    invoke-virtual {p0, v0, v1}, Lcom/netease/newsreader/view/MyGallery;->onKeyDown(ILandroid/view/KeyEvent;)Z

    .line 137
    return-void
.end method


# virtual methods
.method public computeScroll()V
    .locals 4

    .prologue
    const/4 v3, 0x0

    .line 74
    invoke-super {p0}, Landroid/widget/Gallery;->computeScroll()V

    .line 75
    iget-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    .line 76
    .local v0, r:Ljava/lang/Runnable;
    if-eqz v0, :cond_0

    .line 77
    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getSelectedView()Landroid/view/View;

    move-result-object v1

    if-nez v1, :cond_1

    .line 78
    iput-object v3, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    .line 86
    :cond_0
    :goto_0
    return-void

    .line 79
    :cond_1
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->getCenterOfGallery()I

    move-result v1

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->getSelectedView()Landroid/view/View;

    move-result-object v2

    invoke-static {v2}, Lcom/netease/newsreader/view/MyGallery;->getCenterOfView(Landroid/view/View;)I

    move-result v2

    if-ne v1, v2, :cond_0

    .line 80
    iput-object v3, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    .line 81
    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->post(Ljava/lang/Runnable;)Z

    goto :goto_0
.end method

.method protected getChildStaticTransformation(Landroid/view/View;Landroid/view/animation/Transformation;)Z
    .locals 1
    .parameter "child"
    .parameter "t"

    .prologue
    .line 111
    const/4 v0, 0x0

    return v0
.end method

.method protected onDetachedFromWindow()V
    .locals 1

    .prologue
    .line 162
    invoke-super {p0}, Landroid/widget/Gallery;->onDetachedFromWindow()V

    .line 163
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    .line 164
    return-void
.end method

.method public onFling(Landroid/view/MotionEvent;Landroid/view/MotionEvent;FF)Z
    .locals 2
    .parameter "e1"
    .parameter "e2"
    .parameter "velocityX"
    .parameter "velocityY"

    .prologue
    .line 123
    invoke-virtual {p2}, Landroid/view/MotionEvent;->getX()F

    move-result v0

    invoke-virtual {p1}, Landroid/view/MotionEvent;->getX()F

    move-result v1

    cmpl-float v0, v0, v1

    if-lez v0, :cond_0

    .line 124
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->scrollLeft()V

    .line 128
    :goto_0
    const/4 v0, 0x1

    return v0

    .line 126
    :cond_0
    invoke-direct {p0}, Lcom/netease/newsreader/view/MyGallery;->scrollRight()V

    goto :goto_0
.end method

.method public onTouchEvent(Landroid/view/MotionEvent;)Z
    .locals 1
    .parameter "event"

    .prologue
    .line 116
    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    .line 117
    invoke-super {p0, p1}, Landroid/widget/Gallery;->onTouchEvent(Landroid/view/MotionEvent;)Z

    move-result v0

    return v0
.end method

.method protected onWindowVisibilityChanged(I)V
    .locals 1
    .parameter "visibility"

    .prologue
    .line 152
    invoke-super {p0, p1}, Landroid/widget/Gallery;->onWindowVisibilityChanged(I)V

    .line 153
    if-nez p1, :cond_0

    invoke-virtual {p0}, Lcom/netease/newsreader/view/MyGallery;->isShown()Z

    move-result v0

    if-eqz v0, :cond_0

    .line 154
    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    .line 158
    :goto_0
    return-void

    .line 156
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    goto :goto_0
.end method

.method public setAutoRun(I)V
    .locals 1
    .parameter "interval"

    .prologue
    .line 62
    iput p1, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoTimeInterval:I

    .line 63
    if-lez p1, :cond_0

    .line 64
    const/16 v0, 0x3e8

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->setAnimationDuration(I)V

    .line 65
    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    .line 70
    :goto_0
    return-void

    .line 67
    :cond_0
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    goto :goto_0
.end method

.method public setXXXRunnalbe(Ljava/lang/Runnable;)V
    .locals 1
    .parameter "r"

    .prologue
    .line 89
    iget-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    if-eqz v0, :cond_0

    .line 90
    iget-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->removeCallbacks(Ljava/lang/Runnable;)Z

    .line 92
    :cond_0
    iput-object p1, p0, Lcom/netease/newsreader/view/MyGallery;->mXXXRunnable:Ljava/lang/Runnable;

    .line 93
    return-void
.end method

.method public startAutoScroll(Z)V
    .locals 3
    .parameter "autoScroll"

    .prologue
    .line 167
    iget-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoRunnable:Ljava/lang/Runnable;

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/MyGallery;->removeCallbacks(Ljava/lang/Runnable;)Z

    .line 168
    if-eqz p1, :cond_0

    iget v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoTimeInterval:I

    if-lez v0, :cond_0

    .line 169
    iget-object v0, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoRunnable:Ljava/lang/Runnable;

    iget v1, p0, Lcom/netease/newsreader/view/MyGallery;->mAutoTimeInterval:I

    int-to-long v1, v1

    invoke-virtual {p0, v0, v1, v2}, Lcom/netease/newsreader/view/MyGallery;->postDelayed(Ljava/lang/Runnable;J)Z

    .line 171
    :cond_0
    return-void
.end method
